﻿using MyK3CloudCore.IOC;
using MyK3CloudCore.IOC.Extensions;
using System.Net;
using System.Net.Http;

namespace Microsoft.Extensions.DependencyInjection;

public static class K3IOCServiceCollectionExtensions
{
    internal static K3Config Configs;
    internal static readonly CookieContainer _cookie = new();
    internal static IHttpClientFactory HttpClientFactory;
    /// <summary>
    /// K3注入语法糖
    /// </summary>
    public static IServiceCollection AddK3Sugar(this IServiceCollection server, K3Config config)
    {
        Configs = config;
        server.AddDefaultHttpClient(_cookie);
        HttpClientFactory = server.BuildServiceProvider().GetService<IHttpClientFactory>();
        return server;
    }
}

